using System;
using System.Data;
using Wicresoft.Common;
namespace MonthlyDB.Entity
{
    [Table("Monthly", "", "Monthly.ConnectionString")]
    [Serializable]
    public class Monthly : Info
    {
        #region SQL column name consts
        public const string SQLCOL_ID = "ID";
        public const string SQLCOL_SYMBOL = "Symbol";
        public const string SQLCOL_FILENAME = "FileName";
        public const string SQLCOL_CONTENT = "Content";
        public const string SQLCOL_KEYWORDS = "Keywords";
        public const string SQLCOL_PUBLISHTIME = "PublishTime";
        public const string SQLCOL_TYPE = "Type";
        public const string SQLCOL_CREATETIME = "CreateTime";
        public const string SQLCOL_CREATOR = "Creator";
        public const string SQLCOL_CREATORNAME = "CreatorName";
        public const string SQLCOL_DEPTID = "DeptID";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public Monthly() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public Monthly(Guid ID)
        {
            this.ID = ID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            ID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_ID]);
            Symbol = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SYMBOL]);
            FileName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_FILENAME]);
            Content = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_CONTENT]);
            Keywords = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_KEYWORDS]);
            PublishTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_PUBLISHTIME]);
            Type = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TYPE]);
            CreateTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_CREATETIME]);
            Creator = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_CREATOR]);
            CreatorName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_CREATORNAME]);
            DeptID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_DEPTID]);
        }

        #region Properties
        #region Property <Guid> ID
        [Property("ID", 16, SqlDbType.UniqueIdentifier, false, true)]
        public Guid ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private Guid _ID = Guid.Empty;
        #endregion

        #region Property <string> Symbol
        [Property("Symbol", 50, SqlDbType.NVarChar, false, false)]
        public string Symbol
        {
            get { return _Symbol; }
            set { _Symbol = value; }
        }
        private string _Symbol = null;
        #endregion

        #region Property <string> FileName
        [Property("FileName", 50, SqlDbType.NVarChar, false, false)]
        public string FileName
        {
            get { return _FileName; }
            set { _FileName = value; }
        }
        private string _FileName = null;
        #endregion

        #region Property <string> Content
        [Property("Content", 2147483646, SqlDbType.NText, false, false)]
        public string Content
        {
            get { return _Content; }
            set { _Content = value; }
        }
        private string _Content = null;
        #endregion

        #region Property <string> Keywords
        [Property("Keywords", 200, SqlDbType.NVarChar, false, false)]
        public string Keywords
        {
            get { return _Keywords; }
            set { _Keywords = value; }
        }
        private string _Keywords = null;
        #endregion

        #region Property <DateTime> PublishTime
        [Property("PublishTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime PublishTime
        {
            get { return _PublishTime; }
            set { _PublishTime = value; }
        }
        private DateTime _PublishTime = DateTime.MinValue;
        #endregion

        #region Property <string> Type
        [Property("Type", 50, SqlDbType.NVarChar, false, false)]
        public string Type
        {
            get { return _Type; }
            set { _Type = value; }
        }
        private string _Type = null;
        #endregion

        #region Property <DateTime> CreateTime
        [Property("CreateTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime CreateTime
        {
            get { return _CreateTime; }
            set { _CreateTime = value; }
        }
        private DateTime _CreateTime = DateTime.MinValue;
        #endregion

        #region Property <string> Creator
        [Property("Creator", 50, SqlDbType.NVarChar, false, false)]
        public string Creator
        {
            get { return _Creator; }
            set { _Creator = value; }
        }
        private string _Creator = null;
        #endregion

        #region Property <string> CreatorName
        [Property("CreatorName", 50, SqlDbType.NVarChar, false, false)]
        public string CreatorName
        {
            get { return _CreatorName; }
            set { _CreatorName = value; }
        }
        private string _CreatorName = null;
        #endregion

        #region Property <Guid> DeptID
        [Property("DeptID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid DeptID
        {
            get { return _DeptID; }
            set { _DeptID = value; }
        }
        private Guid _DeptID = Guid.Empty;
        #endregion
        #endregion
    }

}
